<%@ page contentType="text/html;charset=UTF-8" language="java" pageEncoding="UTF-8" %>
<%@ page language="java" import="java.util.*" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>
<!DOCTYPE html>
<html lang="en">
<head>
    <title>index</title>
    <base href="<%=basePath%>">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<link href="../static/bootstrap/css/bootstrap.min.css" rel="stylesheet" media="screen">
<script type="text/javascript" src="../static/bootstrap/js/bootstrap.min.js"></script>
<script type="text/javascript" src="../static/js/jquery-1.7.2.js"></script>
<link href="../static/bootstrap/css/bootstrap-responsive.css" rel="stylesheet">
<style>
    .container {
        border: 1px solid powderblue
    }
</style>
<script>
    $(document).ready(function () {
        $("#btn").click(function () {
            /* url: 'http://127.0.0.1:8090/index/v1',*/
            var url = $('#userForm').attr('do');
            var data = $('#userForm').serialize();
            console.log(data);
            $.ajax({
                type: 'post',
                url: url,
                data: data,
                dataType: 'json',
                success: function (data) {
                    if (data.result = "success") {
                        alert("登录成功");
                        location.href = '/pages/success';
                    } else {
                        alert("用户名或者密码错误！");
                    }
                }
            });
        });
    })
</script>

<body style="">
<div class="form-horizontal" id="userForm" action="${pageContext.request.contextPath}/index/v1" method="post">
    <div class="control-group">
        <label class="control-label" for="username"> 账号</label>
        <div class="controls">
            <input type="text" id="username" name="username" placeholder="账号">
        </div>
    </div>
    <div class="control-group">
        <label class="control-label" for="username"> 密码</label>
        <div class="controls">
            <input type="password" id="password" name="password" placeholder="密码">
        </div>
    </div>
    <p id="btn"><a class="btn btn-primary btn-lg" role="button">登录</a></p>
</div>

<div class="container">
    <div class="row clearfix">
        <div class="col-md-12 column">
            <div class="jumbotron">
                <h1>
                    Hello, world!
                </h1>
                <p>
                    This is a template for a simple marketing or informational website. It includes a large callout called the hero unit and three supporting pieces of content. Use it as a starting point to create something more unique.
                </p>
                <p>
                    <a class="btn btn-primary btn-large" href="#">Learn more</a>
                </p>
            </div>
        </div>
    </div>
    <div class="row clearfix">
        <div class="col-md-4 column">
            <h2>
                Heading
            </h2>
            <p>
                Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui.
            </p>
            <p>
                <a class="btn" href="#">View details »</a>
            </p>
        </div>
        <div class="col-md-4 column">
            <h2>
                Heading
            </h2>
            <p>
                Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui.
            </p>
            <p>
                <a class="btn" href="#">View details »</a>
            </p>
        </div>
        <div class="col-md-4 column">
            <h2>
                Heading
            </h2>
            <p>
                Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui.
            </p>
            <p>
                <a class="btn" href="#">View details »</a>
            </p>
        </div>
    </div>
</div>
</body>

</html>
